/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aula.alex;
import java.io.*;
import javax.swing.*;

/**
 *
 * @author Alex Carvalho
 */
public class Exercicio6 
{
    public static void main (String[] args)
    {
        String estensao = "";
        
        File file = new File("D:\\Documentos\\Programação\\Arquivos txt");
        
        File[] files = file.listFiles();
        
        for (File f : files)
        {
            System.out.println("Nome: "+ f.getName()+("-")+f.getParent());
        
            int pos = f.getName().lastIndexOf(".");
            
            
            if (pos != -1)
            {
                estensao = f.getName().substring(pos + 1);
            }
            if (estensao.equals("txt"))
            {
                JOptionPane.showMessageDialog( null,f.getParent()+ f.getName());
            }
                    
        }
        
        
    }
    
}
